package com.java28.rbac.tools;

import org.apache.jasper.compiler.JspUtil;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class AppPathListener implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent sce) {
//        在项目启动时获得Application作用域
        ServletContext context = sce.getServletContext();
//        将项目路径保存在作用域中
        context.setAttribute("path",context.getContextPath());

    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {

    }
}
